package com.chis.ms;

import java.io.*;
import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @Description 
 * @Company zwx
 * @author wlj
 * @version 2019年04月25日
 */
public class Test4 {

    public static void main(String[] args) {
        File file1 = new File("C:\\Users\\wlj\\Desktop\\a.txt");
        File file2 = new File("C:\\Users\\wlj\\Desktop\\b.txt");
        FileReader m = null;
        try {
            m = new FileReader(file2);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        BufferedReader reader = new BufferedReader(m);
        Map<String,String> zonemap = new HashMap<>();
        while (true) {
            String nextline = null;
            try {
                nextline = reader.readLine();
                if (nextline == null) break;
                String[] b = nextline.split("#");
                zonemap.put(b[0],b[1]);

            } catch (IOException e) {
                e.printStackTrace();
            }

        }


        try {
            m = new FileReader(file1);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        reader = new BufferedReader(m);
        StringBuilder sb = new StringBuilder();
        while (true) {
            String nextline = null;
            try {
                nextline = reader.readLine();
                if (nextline == null) break;
                String[] a = nextline.split("#");
                sb = new StringBuilder();
                sb.append("insert into TB_CHILD_TZ_COUNT(UNIT_CODE,TZ_YEAR,TZ_CHILD_COUNT,CREATE_DATE,MODIFY_DATE,ZONE_GB,CREATE_UNIT_CODE) values(");
                sb.append(a[0]).append(",2022,").append(a[1]).append(",now(),now(),");
                sb.append(zonemap.get(a[0])).append(",").append(a[0]).append(");");
                System.out.println(sb.toString());


            } catch (IOException e) {
                e.printStackTrace();
            }

        }




    }




}
